<template>
  <div class="bg-c-fff right-height mb70">
    <div class="bread">
      <a href="" class="font-s-16">首席监控师-交易监控分配记录</a>
    </div>
    <div class="content">
      <table width="100%" class="auto">
        <tr>
          <th>分配时间</th>
          <th>订单编号</th>
          <th>原监控师</th>
          <th>原监控员</th>
          <th>重新分配给</th>
          <th>人员职务</th>
        </tr>
        <tr v-for="item in list">
          <td>{{item.createTime}}</td>
          <td>{{item.serviceId}}</td>
          <td>{{item.oldMonitorName| nameFilter}}</td>
          <td>{{item.oldWorkerName| nameFilter}}</td>
          <td>{{item.newPersonName | nameFilter}}</td>
          <td>{{item.roleType | roleTypeFilter}}</td>
        </tr>
      </table>
      <div class="fix foot-box">
        <pagination :index="pageIndex" :total="pageTotal" v-show="this.list!=0" @pagechange="onPageChange"></pagination>
      </div>
    </div>
  </div>
</template>
<script type="text/javascript">
import Pagination from '../components/Pagination'
export default {
  components: {
    Pagination
  },
  data() {
    return {
      pageIndex: 1,
      pageTotal: 0,
      list: []
    }
  },
  mounted() {
    this.onPageChange(1)
  },
  methods: {
    onPageChange(n) {
      this.getData(n)
    },
    getData(n) {
      this.$http.post('/redistributeRecord/read/list', {
        type: 1
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.pageIndex = n
          this.pageTotal = Math.ceil(data.data.total / 10)
          this.list = data.data.rows
          console.log(this.list)
        } else {
          console.log(data.data.msg)
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
      })
    }
  },
  filters: {
    roleTypeFilter(v) {
      if (v === 1) {
        return '交易监控师'
      } else if (v === 2) {
        return '交易监控员'
      }
    },
    nameFilter(v) {
      if (!v) {
        return '--'
      } else {
        return v
      }
    }
  }
}

</script>
<style type="text/css" scoped>
.right-height {
  min-height: 700px;
}

.bread {
  padding-left: 20px;
  height: 50px;
  border-bottom: 1px solid #ddd;
}

.bread a {
  line-height: 50px;
}

.cm-transaction-list .seach {
  right: 10px;
  top: 8px;
}

.cm-transaction-list .seach input,
.cm-transaction-list .seach button {
  height: 35px;
  line-height: 35px;
}

.content {
  margin-top: 10px;
  padding: 0 30px;
}

.content table {
  margin-top: 20px;
}

.content table td button:nth-of-type(1) {
  margin-bottom: 7px;
}


.foot-box {
  padding: 35px 0px 0px 0px;
}

</style>
